﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>颜色切换板</title>
    <script type="text/javascript">
        function tdColor(num)
        {
            var totalnum = 5;
            var tdStr;
            var i=0;
            for(i=1;i<=totalnum;i++){
                if(i==num){
                    tdStr = "TD"+i+".style.display='block';";      //显示指定的单元格
                }
                else{
                    tdStr = "TD"+i+".style.display='none';";       //隐藏指定的单元格
                }
                eval(tdStr);
            }
        }
    </script>
</head>
<body>
<table width="405" height="279" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td height="30" align="center" valign="middle" bgcolor="#CC3388"><a href="#" onClick="tdColor(1);" >■</a></td>
        <td align="center" valign="middle" bgcolor="#00BBCC"><a href="#" onClick="tdColor(2);" >■</a></td>
        <td align="center" valign="middle" bgcolor="#BB5588"><a href="#" onClick="tdColor(3);" >■</a></td>
        <td align="center" valign="middle" bgcolor="#0088BB"><a href="#" onClick="tdColor(4);" >■</a></td>
        <td align="center" valign="middle" bgcolor="#FFBB33"><a href="#" onClick="tdColor(5);" >■</a></td>
    </tr>
    <tr id="TD1">
        <td height="30" colspan="5" bgcolor="#CC3388">&nbsp;</td>
    </tr>
    <tr id="TD2" style="display:none;">
        <td height="30" colspan="5" bgcolor="#00BBCC">&nbsp;</td>
    </tr>
    <tr id="TD3" style="display:none;">
        <td height="30" colspan="5" bgcolor="#BB5588">&nbsp;</td>
    </tr>
    <tr id="TD4" style="display:none;">
        <td height="30" colspan="5" bgcolor="#0088BB">&nbsp;</td>
    </tr>
    <tr id="TD5" style="display:none;">
        <td height="30" colspan="5" bgcolor="#FFBB33">&nbsp;</td>
    </tr>
</table>
</body>
</html>